#pragma once
#include "Types.h"
#include "Matrix44.h"
#include "Material.h"
#include "GameObject.h"


namespace Boon
{
namespace Rendering
{
	class SceneNode;
	struct AlphaType;



	class SceneNodeProperties
	{
	public:
		SceneNodeProperties() : m_GameObjectID( GameObject::INVALID_ID ), m_Material( nullptr ) { }

		inline const GameObjectID&			GameObjectID() const { return m_GameObjectID;  }
		inline const GameObjectWeak&		GameObject() const { return m_GameObject; }
		inline const char*					Name() const { return m_Name.c_str(); }
		inline bool							HasAlpha() const { return m_Material->HasAlpha(); }
		inline virtual float				Alpha() const { return m_Material->GetAlpha(); }
		inline RenderPass					GetRenderPass() const { return m_RenderPass; }
		inline float						Radius() const { return m_Radius; }
		inline const Material&				GetMaterial() const { return *m_Material; }
		inline const Matrix44&				FromWorld() const { return m_FromWorld; }
		inline const Matrix44&				ToWorld() const { return m_ToWorld; }
		inline void							GetTransform( Matrix44* toworld, Matrix44* fromworld );

	protected:
		Boon::GameObjectID		m_GameObjectID;
		Boon::GameObjectWeak	m_GameObject;
		std::string				m_Name;
		Material*				m_Material;
		RenderPass				m_RenderPass;
		float					m_Radius;
		Boon::Matrix44			m_ToWorld, m_FromWorld;
		float					m_Rotation;
		AlphaType*				m_AlphaType;

		void					SetAlpha( const AlphaType& a )
		{
			//m_AlphaType = &a;
			//m_Material->setlpha( a.alpha );
		}


		friend class SceneNode;
	};

	void SceneNodeProperties::GetTransform( Matrix44* toworld, Matrix44* fromworld )
	{
		if( toworld )
			*toworld = m_ToWorld;
		if( fromworld )
			*fromworld = m_FromWorld;
	}

}
}
